package com.teng.web.servlet.recovery;

import java.io.IOException;
import java.io.Writer;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.teng.dto.JSONResponse;
import com.teng.service.RecoveryService;
import com.teng.service.impl.RecoveryServiceImpl;
import com.teng.util.JSONUtil;


@WebServlet("/api/document/rec/empty")
public class EmptyServlet extends HttpServlet{
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		JSONResponse result=new JSONResponse();
		try {
			req.setCharacterEncoding("utf-8");
			RecoveryService service=new RecoveryServiceImpl();
			service.emptyRecovery();
			result.setCode("ok");
		}catch (Exception e) {
			result.setCode("error");
			result.setMessage("系统繁忙，请稍后再试");
		}finally {
			resp.setCharacterEncoding("utf-8");
			resp.setContentType("application/json");
			Writer out=resp.getWriter();
			out.write(JSONUtil.toJsonString(result));
			out.close();
		}
	}
}
